$('.abs-txt').fancybox({
    showNavArrows : true,
    titleShow : false,
});
$('.review-btn').fancybox({
    titleShow : false,
});
$('.advice-btn').fancybox({
    titleShow : false,
    'type' : 'iframe',
    'width' : '80%',
    'height' : '80%'
});

$('.filter-btn').click(function (e) {
    switch(this.lang) {
        case 'all':
            $('.main-bd .abst').show();
            break;
        case 'pass':
        case 'reject':
        case 'wait':
            $('.main-bd .abst').hide();
            $('.main-bd .abst.box-'+this.lang).show();
            break;
    }
    return false;
});

$('#search-btn').click(function () {
    var tp = $('#search-type').val(), 
        tx = $('#search-text').val().replace(/(^\s*)|(\s*$)/g, ''),
        sc, sd, condition,
        $b = $('.main-bd .abst');

    switch(tp) {
        case 'yid':
            sc = '.abst-id';
            sd = 0;
            break;
        case 'aid':
            sc = '.author-id';
            sd = 0;
            break;
        case 'auni':
            sc = '.author-uni';
            sd = 1;
            break;
        case 'amail':
            sc = '.author-mail';
            sd = 1;
            break;
        case 'aname':
            sc = '.author-name';
            sd = 1;
            break;
        default:
            sd = -1;
    }

    switch(sd) {
        default:
            return ;
        case 0 :
            condition = function() {
                return $(sc, this).html() == tx;
            };
            break;
        case 1 :
            condition = function() {
                return $(sc, this).html().indexOf(tx) >= 0;
            };
            break;
    }

    $b.hide();
    $b.each(function (a) {
        if ( condition.call(this) ) {
            $(this).show();
        }
    });

});